<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>

<? 
if ($arParams["SECTION_ID"]>0) : 
	if ($aParams["SET_SECTIONS_CHAIN"]=="Y") :
?>
	<h4>
<?
	$cnt = count($arResult["SECTIONS"]);
	$n = 1;
	foreach($arResult["SECTIONS"] as $arSection):
		if ($n++ == $cnt)
			echo $arSection["NAME"];
		else
			echo "<a href=\"".$arSection["URL"]."\">".$arSection["NAME"]."</a> / ";
	endforeach;
?>
	</h4>
	<? endif; ?>
<? else: ?>

<table width="100%" border="0" cellspacing="10">
<?
$n = 0;
foreach($arResult["SECTIONS"] as $arSection):

	if ( $n == 0 )
		echo "<tr>";
	echo "<td width='50%' valign='top'>";
?>
	<a href="<?=$arSection["SECTION_PAGE_URL"]?>" class="parent_bd"><?=$arSection["NAME"]?><?if($arSection["ELEMENT_CNT"]>0):?>&nbsp;(<?=$arSection["ELEMENT_CNT"]?>)<?endif;?></a><br />
<?
	foreach($arSection["SECTIONS"] as $arSect):
?>
		<a href="<?=$arSect["SECTION_PAGE_URL"]?>" class="child_bd"><?=$arSect["NAME"]?><?if($arSect["ELEMENT_CNT"]>0):?>&nbsp;(<?=$arSect["ELEMENT_CNT"]?>)<?endif;?></a>
<?		
	endforeach;
	echo "</td>";
	if (++$n == 2)
	{
		echo "</tr>";
		$n = 0;
	}	
?>
<?endforeach?>
<?
if ( $n > 0 )
	echo "<td>&nbsp;</td></tr>";
?>
</table>

<? endif; ?>